package com.example.demo.api;

public class StringUtil {
	
	public static String stringToAscii(String value)  
	{  
	    StringBuffer sbu = new StringBuffer();  
	    char[] chars = value.toCharArray();   
	    for (int i = 0; i < chars.length; i++) {  
//	        if(i != chars.length - 1)  
//	        {  
//	            sbu.append((int)chars[i]).append(",");  
//	        }  
//	        else {  
	            sbu.append((int)chars[i]);  
	      //  }  
	    }  
	    return sbu.toString();  
	} 
	
	public static String asciiToString(String value)  
	{  
	    StringBuffer sbu = new StringBuffer();  
	    String[] chars = value.split(",");  
	    for (int i = 0; i < chars.length; i++) {  
	    	try {
	        sbu.append((char) Integer.parseInt(chars[i]));  
	    	} catch (Exception e) {
	    		 sbu.append(chars[i]);  
			}
	    }  
	    return sbu.toString();  
	}  

}
